package com.yequan.thread.forkjoin;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.RecursiveAction;

/**
 * @author yequan
 * @date 2019/12/21
 */
public class FileDeleteTask extends RecursiveAction {

    /**
     * 阈值
     */
    private static final int THRESHOLD = 10;

    private List<File> fileList;

    public FileDeleteTask(List<File> fileList) {
        this.fileList = fileList;
    }

    @Override
    protected void compute() {
        if (fileList.size() <= THRESHOLD) {
            for (File file : fileList) {
                if (file.isDirectory()) {
                    List<File> files = Arrays.asList(file.listFiles());
                }
            }
        }
    }
}
